﻿package no.doomsday.aronning.engines.verlets.constraints 
{
	import no.doomsday.aronning.engines.verlets.IConstrainable;
	import no.doomsday.aronning.engines.verlets.IUpdatable;
	import no.doomsday.aronning.engines.verlets.utils.LinkedListNode;
	import no.doomsday.aronning.engines.verlets.Verlet;
	
	/**
	 * ...
	 * @author Andreas Rønning
	 */
	public class AbstractConstraint extends LinkedListNode implements IConstraint
	{
		
		public var constrainedVerlets:Vector.<Verlet> = new Vector.<Verlet>();
		public function AbstractConstraint() 
		{
			
		}
		public function addVerlet(v:Verlet):Boolean {
			if (constrainedVerlets.indexOf(v) > -1) return false;
			constrainedVerlets.push(v);
			return true;
		}
		public function removeVerlet(v:Verlet):Boolean {
			var idx:int = constrainedVerlets.indexOf(v);
			if (idx < 0) { 
				return false;
			}
			constrainedVerlets.splice(idx, 1);
			return true;
		}
		
	}
	
}